package cn.lg.soar.cms.biz.modules.other.entity;

import cn.lg.soar.core.annotations.constraints.group.Create;
import cn.lg.soar.core.annotations.constraints.group.Update;
import cn.lg.soar.database.base.entity.BaseEntity;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;

/**
 * 页面元素内容
 * @author luguoxiang
 * @since 2025-02-23
 * 开源项目：https://gitee.com/lgx1992/lg-soar 求star！请给我star！请帮我点个star！
 */
@Data
@Schema(description = "页面元素内容")
@TableName("lg_cms_block_item")
public class BlockItem extends BaseEntity {

    /** 封面图 */
    @NotBlank(message = "封面图不能为空", groups = { Create.class, Update.class })
    @ExcelProperty(value = "封面图")
    @Schema(description = "封面图")
    private String coverImage;

    /**  */
    @NotNull(message = "主键不能为空", groups = { Update.class })
    @ExcelIgnore
    @Schema(description = "主键")
    @TableId
    private Long id;

    /** 元数据(携带的参数，如：url、id、json) */
    @ExcelProperty(value = "元数据(携带的参数，如：url、id、json)")
    @Schema(description = "元数据(携带的参数，如：url、id、json)")
    private String metadata;

    /** 位置id */
    @NotNull(message = "位置id不能为空", groups = { Create.class, Update.class })
    @ExcelProperty(value = "位置id")
    @Schema(description = "位置id")
    private Long positionId;

    /** 排序 */
    @NotNull(message = "排序不能为空", groups = { Create.class, Update.class })
    @ExcelProperty(value = "排序")
    @Schema(description = "排序")
    private Integer sort;

    /** 状态 */
    @NotNull(message = "状态不能为空", groups = { Create.class, Update.class })
    @ExcelProperty(value = "状态")
    @Schema(description = "状态")
    private Integer status;

    /** 副标题 */
    @ExcelProperty(value = "副标题")
    @Schema(description = "副标题")
    private String subtitle;

    /** 租户id */
    @NotNull(message = "租户id不能为空", groups = { Create.class, Update.class })
    @ExcelProperty(value = "租户id")
    @Schema(description = "租户id")
    private Integer tenantId;

    /** 标题 */
    @NotBlank(message = "标题不能为空", groups = { Create.class, Update.class })
    @ExcelProperty(value = "标题")
    @Schema(description = "标题")
    private String title;

    @JsonIgnore
    @Override
    public Long primaryKey() {
        return this.id;
    }

}
